﻿namespace Smart.ERP
{
    using Smart.Data.Helper;
    using Smart.Utils.Lib;
    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Windows.Forms;

    public class CUSTOMER
    {
        private bool m_Active;
        private string m_Area;
        private string m_BankAccount;
        private string m_BankName;
        private string m_Barcode;
        private string m_Birthday;
        private string m_City;
        private string m_Contact;
        private string m_Contry;
        private double m_CreditLimit;
        private string m_Customer_Group_ID;
        private string m_Customer_ID;
        private string m_Customer_Type_ID;
        private string m_CustomerAddress;
        private string m_CustomerName;
        private string m_Description;
        private double m_Discount;
        private string m_District;
        private string m_Email;
        private string m_Fax;
        private string m_Mobile;
        private string m_NickSky;
        private string m_NickYM;
        private long m_OrderID;
        private string m_Position;
        private string m_Tax;
        private string m_Tel;
        private string m_Website;

        public CUSTOMER()
        {
            this.m_Customer_ID = "";
            this.m_OrderID = 0L;
            this.m_CustomerName = "";
            this.m_Customer_Type_ID = "";
            this.m_Customer_Group_ID = "";
            this.m_CustomerAddress = "";
            this.m_Birthday = "";
            this.m_Barcode = "";
            this.m_Tax = "";
            this.m_Tel = "";
            this.m_Fax = "";
            this.m_Email = "";
            this.m_Mobile = "";
            this.m_Website = "";
            this.m_Contact = "";
            this.m_Position = "";
            this.m_NickYM = "";
            this.m_NickSky = "";
            this.m_Area = "";
            this.m_District = "";
            this.m_Contry = "";
            this.m_City = "";
            this.m_BankAccount = "";
            this.m_BankName = "";
            this.m_CreditLimit = 0.0;
            this.m_Discount = 0.0;
            this.m_Description = "";
            this.m_Active = true;
        }

        public CUSTOMER(string Customer_ID, long OrderID, string CustomerName, string Customer_Type_ID, string Customer_Group_ID, string CustomerAddress, string Birthday, string Barcode, string Tax, string Tel, string Fax, string Email, string Mobile, string Website, string Contact, string Position, string NickYM, string NickSky, string Area, string District, string Contry, string City, string BankAccount, string BankName, double CreditLimit, double Discount, string Description, bool Active)
        {
            this.m_Customer_ID = Customer_ID;
            this.m_OrderID = OrderID;
            this.m_CustomerName = CustomerName;
            this.m_Customer_Type_ID = Customer_Type_ID;
            this.m_Customer_Group_ID = Customer_Group_ID;
            this.m_CustomerAddress = CustomerAddress;
            this.m_Birthday = Birthday;
            this.m_Barcode = Barcode;
            this.m_Tax = Tax;
            this.m_Tel = Tel;
            this.m_Fax = Fax;
            this.m_Email = Email;
            this.m_Mobile = Mobile;
            this.m_Website = Website;
            this.m_Contact = Contact;
            this.m_Position = Position;
            this.m_NickYM = NickYM;
            this.m_NickSky = NickSky;
            this.m_Area = Area;
            this.m_District = District;
            this.m_Contry = Contry;
            this.m_City = City;
            this.m_BankAccount = BankAccount;
            this.m_BankName = BankName;
            this.m_CreditLimit = CreditLimit;
            this.m_Discount = Discount;
            this.m_Description = Description;
            this.m_Active = Active;
        }

        public void AddCombo(ComboBox combo)
        {
            MyLib.TableToComboBox(combo, this.GetList(), "CUSTOMERName", "CUSTOMER_ID");
        }

        public void AddComboAll(ComboBox combo)
        {
            DataTable list = new DataTable();
            list = this.GetList();
            DataRow row = list.NewRow();
            row["CUSTOMER_ID"] = "All";
            row["CUSTOMERName"] = "Tất cả";
            list.Rows.InsertAt(row, 0);
            MyLib.TableToComboBox(combo, list, "CUSTOMERName", "CUSTOMER_ID");
        }

        public string Delete()
        {
            string[] myParams = new string[] { "@Customer_ID" };
            object[] myValues = new object[] { this.m_Customer_ID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("CUSTOMER_Delete", myParams, myValues);
        }

        public string Delete(string Customer_ID)
        {
            string[] myParams = new string[] { "@Customer_ID" };
            object[] myValues = new object[] { Customer_ID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("CUSTOMER_Delete", myParams, myValues);
        }

        public string Delete(SqlConnection myConnection, string Customer_ID)
        {
            string[] myParams = new string[] { "@Customer_ID" };
            object[] myValues = new object[] { Customer_ID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "CUSTOMER_Delete", myParams, myValues);
        }

        public string Delete(SqlTransaction myTransaction, string Customer_ID)
        {
            string[] myParams = new string[] { "@Customer_ID" };
            object[] myValues = new object[] { Customer_ID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "CUSTOMER_Delete", myParams, myValues);
        }

        public bool Exist(string Customer_ID)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@Customer_ID" };
            object[] myValues = new object[] { Customer_ID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("CUSTOMER_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                helper.Close();
                reader = null;
            }
            return hasRows;
        }

        public bool Exist(SqlTransaction myTransaction, string Customer_ID)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@Customer_ID" };
            object[] myValues = new object[] { Customer_ID };
            SqlDataReader reader = new SqlHelper().ExecuteReader(myTransaction, "CUSTOMER_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                reader.Dispose();
            }
            return hasRows;
        }

        public string Get(string Customer_ID)
        {
            string str = "";
            string[] myParams = new string[] { "@Customer_ID" };
            object[] myValues = new object[] { Customer_ID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("CUSTOMER_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_Customer_ID = Convert.ToString(reader["Customer_ID"]);
                    this.m_OrderID = Convert.ToInt64(reader["OrderID"]);
                    this.m_CustomerName = Convert.ToString(reader["CustomerName"]);
                    this.m_Customer_Type_ID = Convert.ToString(reader["Customer_Type_ID"]);
                    this.m_Customer_Group_ID = Convert.ToString(reader["Customer_Group_ID"]);
                    this.m_CustomerAddress = Convert.ToString(reader["CustomerAddress"]);
                    this.m_Birthday = Convert.ToString(reader["Birthday"]);
                    this.m_Barcode = Convert.ToString(reader["Barcode"]);
                    this.m_Tax = Convert.ToString(reader["Tax"]);
                    this.m_Tel = Convert.ToString(reader["Tel"]);
                    this.m_Fax = Convert.ToString(reader["Fax"]);
                    this.m_Email = Convert.ToString(reader["Email"]);
                    this.m_Mobile = Convert.ToString(reader["Mobile"]);
                    this.m_Website = Convert.ToString(reader["Website"]);
                    this.m_Contact = Convert.ToString(reader["Contact"]);
                    this.m_Position = Convert.ToString(reader["Position"]);
                    this.m_NickYM = Convert.ToString(reader["NickYM"]);
                    this.m_NickSky = Convert.ToString(reader["NickSky"]);
                    this.m_Area = Convert.ToString(reader["Area"]);
                    this.m_District = Convert.ToString(reader["District"]);
                    this.m_Contry = Convert.ToString(reader["Contry"]);
                    this.m_City = Convert.ToString(reader["City"]);
                    this.m_BankAccount = Convert.ToString(reader["BankAccount"]);
                    this.m_BankName = Convert.ToString(reader["BankName"]);
                    this.m_CreditLimit = Convert.ToSingle(reader["CreditLimit"]);
                    this.m_Discount = Convert.ToSingle(reader["Discount"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    this.m_Active = Convert.ToBoolean(reader["Active"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlConnection myConnection, string Customer_ID)
        {
            string str = "";
            string[] myParams = new string[] { "@Customer_ID" };
            object[] myValues = new object[] { Customer_ID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myConnection, "CUSTOMER_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_Customer_ID = Convert.ToString(reader["Customer_ID"]);
                    this.m_OrderID = Convert.ToInt64(reader["OrderID"]);
                    this.m_CustomerName = Convert.ToString(reader["CustomerName"]);
                    this.m_Customer_Type_ID = Convert.ToString(reader["Customer_Type_ID"]);
                    this.m_Customer_Group_ID = Convert.ToString(reader["Customer_Group_ID"]);
                    this.m_CustomerAddress = Convert.ToString(reader["CustomerAddress"]);
                    this.m_Birthday = Convert.ToString(reader["Birthday"]);
                    this.m_Barcode = Convert.ToString(reader["Barcode"]);
                    this.m_Tax = Convert.ToString(reader["Tax"]);
                    this.m_Tel = Convert.ToString(reader["Tel"]);
                    this.m_Fax = Convert.ToString(reader["Fax"]);
                    this.m_Email = Convert.ToString(reader["Email"]);
                    this.m_Mobile = Convert.ToString(reader["Mobile"]);
                    this.m_Website = Convert.ToString(reader["Website"]);
                    this.m_Contact = Convert.ToString(reader["Contact"]);
                    this.m_Position = Convert.ToString(reader["Position"]);
                    this.m_NickYM = Convert.ToString(reader["NickYM"]);
                    this.m_NickSky = Convert.ToString(reader["NickSky"]);
                    this.m_Area = Convert.ToString(reader["Area"]);
                    this.m_District = Convert.ToString(reader["District"]);
                    this.m_Contry = Convert.ToString(reader["Contry"]);
                    this.m_City = Convert.ToString(reader["City"]);
                    this.m_BankAccount = Convert.ToString(reader["BankAccount"]);
                    this.m_BankName = Convert.ToString(reader["BankName"]);
                    this.m_CreditLimit = Convert.ToSingle(reader["CreditLimit"]);
                    this.m_Discount = Convert.ToSingle(reader["Discount"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    this.m_Active = Convert.ToBoolean(reader["Active"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlTransaction myTransaction, string Customer_ID)
        {
            string str = "";
            string[] myParams = new string[] { "@Customer_ID" };
            object[] myValues = new object[] { Customer_ID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myTransaction, "CUSTOMER_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_Customer_ID = Convert.ToString(reader["Customer_ID"]);
                    this.m_OrderID = Convert.ToInt64(reader["OrderID"]);
                    this.m_CustomerName = Convert.ToString(reader["CustomerName"]);
                    this.m_Customer_Type_ID = Convert.ToString(reader["Customer_Type_ID"]);
                    this.m_Customer_Group_ID = Convert.ToString(reader["Customer_Group_ID"]);
                    this.m_CustomerAddress = Convert.ToString(reader["CustomerAddress"]);
                    this.m_Birthday = Convert.ToString(reader["Birthday"]);
                    this.m_Barcode = Convert.ToString(reader["Barcode"]);
                    this.m_Tax = Convert.ToString(reader["Tax"]);
                    this.m_Tel = Convert.ToString(reader["Tel"]);
                    this.m_Fax = Convert.ToString(reader["Fax"]);
                    this.m_Email = Convert.ToString(reader["Email"]);
                    this.m_Mobile = Convert.ToString(reader["Mobile"]);
                    this.m_Website = Convert.ToString(reader["Website"]);
                    this.m_Contact = Convert.ToString(reader["Contact"]);
                    this.m_Position = Convert.ToString(reader["Position"]);
                    this.m_NickYM = Convert.ToString(reader["NickYM"]);
                    this.m_NickSky = Convert.ToString(reader["NickSky"]);
                    this.m_Area = Convert.ToString(reader["Area"]);
                    this.m_District = Convert.ToString(reader["District"]);
                    this.m_Contry = Convert.ToString(reader["Contry"]);
                    this.m_City = Convert.ToString(reader["City"]);
                    this.m_BankAccount = Convert.ToString(reader["BankAccount"]);
                    this.m_BankName = Convert.ToString(reader["BankName"]);
                    this.m_CreditLimit = Convert.ToSingle(reader["CreditLimit"]);
                    this.m_Discount = Convert.ToSingle(reader["Discount"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    this.m_Active = Convert.ToBoolean(reader["Active"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public DataTable GetList()
        {
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("CUSTOMER_GetList");
        }

        public string Insert()
        {
            string[] myParams = new string[] { 
                "@Customer_ID", "@OrderID", "@CustomerName", "@Customer_Type_ID", "@Customer_Group_ID", "@CustomerAddress", "@Birthday", "@Barcode", "@Tax", "@Tel", "@Fax", "@Email", "@Mobile", "@Website", "@Contact", "@Position", 
                "@NickYM", "@NickSky", "@Area", "@District", "@Contry", "@City", "@BankAccount", "@BankName", "@CreditLimit", "@Discount", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                this.m_Customer_ID, this.m_OrderID, this.m_CustomerName, this.m_Customer_Type_ID, this.m_Customer_Group_ID, this.m_CustomerAddress, this.m_Birthday, this.m_Barcode, this.m_Tax, this.m_Tel, this.m_Fax, this.m_Email, this.m_Mobile, this.m_Website, this.m_Contact, this.m_Position, 
                this.m_NickYM, this.m_NickSky, this.m_Area, this.m_District, this.m_Contry, this.m_City, this.m_BankAccount, this.m_BankName, this.m_CreditLimit, this.m_Discount, this.m_Description, this.m_Active
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("CUSTOMER_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction)
        {
            string[] myParams = new string[] { 
                "@Customer_ID", "@OrderID", "@CustomerName", "@Customer_Type_ID", "@Customer_Group_ID", "@CustomerAddress", "@Birthday", "@Barcode", "@Tax", "@Tel", "@Fax", "@Email", "@Mobile", "@Website", "@Contact", "@Position", 
                "@NickYM", "@NickSky", "@Area", "@District", "@Contry", "@City", "@BankAccount", "@BankName", "@CreditLimit", "@Discount", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                this.m_Customer_ID, this.m_OrderID, this.m_CustomerName, this.m_Customer_Type_ID, this.m_Customer_Group_ID, this.m_CustomerAddress, this.m_Birthday, this.m_Barcode, this.m_Tax, this.m_Tel, this.m_Fax, this.m_Email, this.m_Mobile, this.m_Website, this.m_Contact, this.m_Position, 
                this.m_NickYM, this.m_NickSky, this.m_Area, this.m_District, this.m_Contry, this.m_City, this.m_BankAccount, this.m_BankName, this.m_CreditLimit, this.m_Discount, this.m_Description, this.m_Active
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "CUSTOMER_Insert", myParams, myValues);
        }

        public string Insert(string Customer_ID, long OrderID, string CustomerName, string Customer_Type_ID, string Customer_Group_ID, string CustomerAddress, string Birthday, string Barcode, string Tax, string Tel, string Fax, string Email, string Mobile, string Website, string Contact, string Position, string NickYM, string NickSky, string Area, string District, string Contry, string City, string BankAccount, string BankName, double CreditLimit, double Discount, string Description, bool Active)
        {
            string[] myParams = new string[] { 
                "@Customer_ID", "@OrderID", "@CustomerName", "@Customer_Type_ID", "@Customer_Group_ID", "@CustomerAddress", "@Birthday", "@Barcode", "@Tax", "@Tel", "@Fax", "@Email", "@Mobile", "@Website", "@Contact", "@Position", 
                "@NickYM", "@NickSky", "@Area", "@District", "@Contry", "@City", "@BankAccount", "@BankName", "@CreditLimit", "@Discount", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                Customer_ID, OrderID, CustomerName, Customer_Type_ID, Customer_Group_ID, CustomerAddress, Birthday, Barcode, Tax, Tel, Fax, Email, Mobile, Website, Contact, Position, 
                NickYM, NickSky, Area, District, Contry, City, BankAccount, BankName, CreditLimit, Discount, Description, Active
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("CUSTOMER_Insert", myParams, myValues);
        }

        public string Insert(SqlConnection myConnection, string Customer_ID, long OrderID, string CustomerName, string Customer_Type_ID, string Customer_Group_ID, string CustomerAddress, string Birthday, string Barcode, string Tax, string Tel, string Fax, string Email, string Mobile, string Website, string Contact, string Position, string NickYM, string NickSky, string Area, string District, string Contry, string City, string BankAccount, string BankName, double CreditLimit, double Discount, string Description, bool Active)
        {
            string[] myParams = new string[] { 
                "@Customer_ID", "@OrderID", "@CustomerName", "@Customer_Type_ID", "@Customer_Group_ID", "@CustomerAddress", "@Birthday", "@Barcode", "@Tax", "@Tel", "@Fax", "@Email", "@Mobile", "@Website", "@Contact", "@Position", 
                "@NickYM", "@NickSky", "@Area", "@District", "@Contry", "@City", "@BankAccount", "@BankName", "@CreditLimit", "@Discount", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                Customer_ID, OrderID, CustomerName, Customer_Type_ID, Customer_Group_ID, CustomerAddress, Birthday, Barcode, Tax, Tel, Fax, Email, Mobile, Website, Contact, Position, 
                NickYM, NickSky, Area, District, Contry, City, BankAccount, BankName, CreditLimit, Discount, Description, Active
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "CUSTOMER_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction, string Customer_ID, long OrderID, string CustomerName, string Customer_Type_ID, string Customer_Group_ID, string CustomerAddress, string Birthday, string Barcode, string Tax, string Tel, string Fax, string Email, string Mobile, string Website, string Contact, string Position, string NickYM, string NickSky, string Area, string District, string Contry, string City, string BankAccount, string BankName, double CreditLimit, double Discount, string Description, bool Active)
        {
            string[] myParams = new string[] { 
                "@Customer_ID", "@OrderID", "@CustomerName", "@Customer_Type_ID", "@Customer_Group_ID", "@CustomerAddress", "@Birthday", "@Barcode", "@Tax", "@Tel", "@Fax", "@Email", "@Mobile", "@Website", "@Contact", "@Position", 
                "@NickYM", "@NickSky", "@Area", "@District", "@Contry", "@City", "@BankAccount", "@BankName", "@CreditLimit", "@Discount", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                Customer_ID, OrderID, CustomerName, Customer_Type_ID, Customer_Group_ID, CustomerAddress, Birthday, Barcode, Tax, Tel, Fax, Email, Mobile, Website, Contact, Position, 
                NickYM, NickSky, Area, District, Contry, City, BankAccount, BankName, CreditLimit, Discount, Description, Active
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "CUSTOMER_Insert", myParams, myValues);
        }

        public string NewID()
        {
            return SqlHelper.GenCode("CUSTOMER", "Customer_ID", "KH");
        }

        public DataTable Search(string Customer_ID, string CustomerName)
        {
            string[] myParams = new string[] { "@Customer_ID", "@CustomerName" };
            object[] myValues = new object[] { "%" + Customer_ID + "%", "%" + CustomerName + "%" };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("CUSTOMER_Search", myParams, myValues);
        }

        public string Update()
        {
            string[] myParams = new string[] { 
                "@Customer_ID", "@OrderID", "@CustomerName", "@Customer_Type_ID", "@Customer_Group_ID", "@CustomerAddress", "@Birthday", "@Barcode", "@Tax", "@Tel", "@Fax", "@Email", "@Mobile", "@Website", "@Contact", "@Position", 
                "@NickYM", "@NickSky", "@Area", "@District", "@Contry", "@City", "@BankAccount", "@BankName", "@CreditLimit", "@Discount", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                this.m_Customer_ID, this.m_OrderID, this.m_CustomerName, this.m_Customer_Type_ID, this.m_Customer_Group_ID, this.m_CustomerAddress, this.m_Birthday, this.m_Barcode, this.m_Tax, this.m_Tel, this.m_Fax, this.m_Email, this.m_Mobile, this.m_Website, this.m_Contact, this.m_Position, 
                this.m_NickYM, this.m_NickSky, this.m_Area, this.m_District, this.m_Contry, this.m_City, this.m_BankAccount, this.m_BankName, this.m_CreditLimit, this.m_Discount, this.m_Description, this.m_Active
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("CUSTOMER_Update", myParams, myValues);
        }

        public string Update(SqlTransaction myTransaction)
        {
            string[] myParams = new string[] { 
                "@Customer_ID", "@OrderID", "@CustomerName", "@Customer_Type_ID", "@Customer_Group_ID", "@CustomerAddress", "@Birthday", "@Barcode", "@Tax", "@Tel", "@Fax", "@Email", "@Mobile", "@Website", "@Contact", "@Position", 
                "@NickYM", "@NickSky", "@Area", "@District", "@Contry", "@City", "@BankAccount", "@BankName", "@CreditLimit", "@Discount", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                this.m_Customer_ID, this.m_OrderID, this.m_CustomerName, this.m_Customer_Type_ID, this.m_Customer_Group_ID, this.m_CustomerAddress, this.m_Birthday, this.m_Barcode, this.m_Tax, this.m_Tel, this.m_Fax, this.m_Email, this.m_Mobile, this.m_Website, this.m_Contact, this.m_Position, 
                this.m_NickYM, this.m_NickSky, this.m_Area, this.m_District, this.m_Contry, this.m_City, this.m_BankAccount, this.m_BankName, this.m_CreditLimit, this.m_Discount, this.m_Description, this.m_Active
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "CUSTOMER_Update", myParams, myValues);
        }

        public string Update(string Customer_ID, long OrderID, string CustomerName, string Customer_Type_ID, string Customer_Group_ID, string CustomerAddress, string Birthday, string Barcode, string Tax, string Tel, string Fax, string Email, string Mobile, string Website, string Contact, string Position, string NickYM, string NickSky, string Area, string District, string Contry, string City, string BankAccount, string BankName, double CreditLimit, double Discount, string Description, bool Active)
        {
            string[] myParams = new string[] { 
                "@Customer_ID", "@OrderID", "@CustomerName", "@Customer_Type_ID", "@Customer_Group_ID", "@CustomerAddress", "@Birthday", "@Barcode", "@Tax", "@Tel", "@Fax", "@Email", "@Mobile", "@Website", "@Contact", "@Position", 
                "@NickYM", "@NickSky", "@Area", "@District", "@Contry", "@City", "@BankAccount", "@BankName", "@CreditLimit", "@Discount", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                Customer_ID, OrderID, CustomerName, Customer_Type_ID, Customer_Group_ID, CustomerAddress, Birthday, Barcode, Tax, Tel, Fax, Email, Mobile, Website, Contact, Position, 
                NickYM, NickSky, Area, District, Contry, City, BankAccount, BankName, CreditLimit, Discount, Description, Active
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("CUSTOMER_Update", myParams, myValues);
        }

        public string Update(SqlConnection myConnection, string Customer_ID, long OrderID, string CustomerName, string Customer_Type_ID, string Customer_Group_ID, string CustomerAddress, string Birthday, string Barcode, string Tax, string Tel, string Fax, string Email, string Mobile, string Website, string Contact, string Position, string NickYM, string NickSky, string Area, string District, string Contry, string City, string BankAccount, string BankName, double CreditLimit, double Discount, string Description, bool Active)
        {
            string[] myParams = new string[] { 
                "@Customer_ID", "@OrderID", "@CustomerName", "@Customer_Type_ID", "@Customer_Group_ID", "@CustomerAddress", "@Birthday", "@Barcode", "@Tax", "@Tel", "@Fax", "@Email", "@Mobile", "@Website", "@Contact", "@Position", 
                "@NickYM", "@NickSky", "@Area", "@District", "@Contry", "@City", "@BankAccount", "@BankName", "@CreditLimit", "@Discount", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                Customer_ID, OrderID, CustomerName, Customer_Type_ID, Customer_Group_ID, CustomerAddress, Birthday, Barcode, Tax, Tel, Fax, Email, Mobile, Website, Contact, Position, 
                NickYM, NickSky, Area, District, Contry, City, BankAccount, BankName, CreditLimit, Discount, Description, Active
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "CUSTOMER_Update", myParams, myValues);
        }

        public string Update(SqlTransaction myTransaction, string Customer_ID, long OrderID, string CustomerName, string Customer_Type_ID, string Customer_Group_ID, string CustomerAddress, string Birthday, string Barcode, string Tax, string Tel, string Fax, string Email, string Mobile, string Website, string Contact, string Position, string NickYM, string NickSky, string Area, string District, string Contry, string City, string BankAccount, string BankName, double CreditLimit, double Discount, string Description, bool Active)
        {
            string[] myParams = new string[] { 
                "@Customer_ID", "@OrderID", "@CustomerName", "@Customer_Type_ID", "@Customer_Group_ID", "@CustomerAddress", "@Birthday", "@Barcode", "@Tax", "@Tel", "@Fax", "@Email", "@Mobile", "@Website", "@Contact", "@Position", 
                "@NickYM", "@NickSky", "@Area", "@District", "@Contry", "@City", "@BankAccount", "@BankName", "@CreditLimit", "@Discount", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                Customer_ID, OrderID, CustomerName, Customer_Type_ID, Customer_Group_ID, CustomerAddress, Birthday, Barcode, Tax, Tel, Fax, Email, Mobile, Website, Contact, Position, 
                NickYM, NickSky, Area, District, Contry, City, BankAccount, BankName, CreditLimit, Discount, Description, Active
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "CUSTOMER_Update", myParams, myValues);
        }

        public bool Active
        {
            get
            {
                return this.m_Active;
            }
            set
            {
                this.m_Active = value;
            }
        }

        public string Area
        {
            get
            {
                return this.m_Area;
            }
            set
            {
                this.m_Area = value;
            }
        }

        public string BankAccount
        {
            get
            {
                return this.m_BankAccount;
            }
            set
            {
                this.m_BankAccount = value;
            }
        }

        public string BankName
        {
            get
            {
                return this.m_BankName;
            }
            set
            {
                this.m_BankName = value;
            }
        }

        public string Barcode
        {
            get
            {
                return this.m_Barcode;
            }
            set
            {
                this.m_Barcode = value;
            }
        }

        public string Birthday
        {
            get
            {
                return this.m_Birthday;
            }
            set
            {
                this.m_Birthday = value;
            }
        }

        public string City
        {
            get
            {
                return this.m_City;
            }
            set
            {
                this.m_City = value;
            }
        }

        public string Contact
        {
            get
            {
                return this.m_Contact;
            }
            set
            {
                this.m_Contact = value;
            }
        }

        public string Contry
        {
            get
            {
                return this.m_Contry;
            }
            set
            {
                this.m_Contry = value;
            }
        }

        public double CreditLimit
        {
            get
            {
                return this.m_CreditLimit;
            }
            set
            {
                this.m_CreditLimit = value;
            }
        }

        public string Customer_Group_ID
        {
            get
            {
                return this.m_Customer_Group_ID;
            }
            set
            {
                this.m_Customer_Group_ID = value;
            }
        }

        public string Customer_ID
        {
            get
            {
                return this.m_Customer_ID;
            }
            set
            {
                this.m_Customer_ID = value;
            }
        }

        public string Customer_Type_ID
        {
            get
            {
                return this.m_Customer_Type_ID;
            }
            set
            {
                this.m_Customer_Type_ID = value;
            }
        }

        public string CustomerAddress
        {
            get
            {
                return this.m_CustomerAddress;
            }
            set
            {
                this.m_CustomerAddress = value;
            }
        }

        public string CustomerName
        {
            get
            {
                return this.m_CustomerName;
            }
            set
            {
                this.m_CustomerName = value;
            }
        }

        public string Description
        {
            get
            {
                return this.m_Description;
            }
            set
            {
                this.m_Description = value;
            }
        }

        public double Discount
        {
            get
            {
                return this.m_Discount;
            }
            set
            {
                this.m_Discount = value;
            }
        }

        public string District
        {
            get
            {
                return this.m_District;
            }
            set
            {
                this.m_District = value;
            }
        }

        public string Email
        {
            get
            {
                return this.m_Email;
            }
            set
            {
                this.m_Email = value;
            }
        }

        public string Fax
        {
            get
            {
                return this.m_Fax;
            }
            set
            {
                this.m_Fax = value;
            }
        }

        public string Mobile
        {
            get
            {
                return this.m_Mobile;
            }
            set
            {
                this.m_Mobile = value;
            }
        }

        public string NickSky
        {
            get
            {
                return this.m_NickSky;
            }
            set
            {
                this.m_NickSky = value;
            }
        }

        public string NickYM
        {
            get
            {
                return this.m_NickYM;
            }
            set
            {
                this.m_NickYM = value;
            }
        }

        public long OrderID
        {
            get
            {
                return this.m_OrderID;
            }
            set
            {
                this.m_OrderID = value;
            }
        }

        public string Position
        {
            get
            {
                return this.m_Position;
            }
            set
            {
                this.m_Position = value;
            }
        }

        public string ProductName
        {
            get
            {
                return "Class CUSTOMER";
            }
        }

        public string ProductVersion
        {
            get
            {
                return "1.0.0.0";
            }
        }

        public string Tax
        {
            get
            {
                return this.m_Tax;
            }
            set
            {
                this.m_Tax = value;
            }
        }

        public string Tel
        {
            get
            {
                return this.m_Tel;
            }
            set
            {
                this.m_Tel = value;
            }
        }

        public string Website
        {
            get
            {
                return this.m_Website;
            }
            set
            {
                this.m_Website = value;
            }
        }
    }
}

